package com.hkccommunity.mapper;

import com.hkccommunity.entity.AnswerParent;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface AnswerParentMapper {


    @Select("select count(*) from answer_parent where create_user = #{id} and `delete` = 0;")
    int getCountByProblem(@Param("id") Long createId);


    @Select("select * from answer_parent where problem_id = #{id} and `delete` = 0;")
    @ResultMap("answerParentResultMap")
    List<AnswerParent> getAnswerByProblemId(@Param("id") Long problemId);

    @Insert("insert into answer_parent values (#{answerId},#{problemId},#{answerContent},#{createUser},#{createTime},#{delete},#{like})")
    int addAnswerParent(AnswerParent parent);
}
